import api from '../index'
import config from "@/config"

export const supplierList = () => {
	const url = `${config.pre}/supplier-activity/supplier/list`
	return api.get(url)
}

export const supplierAllList = params => {
	const url = `${config.pre}/supplier-activity/supplier/list`
	return api.post(url, params)
}

export const supplierPageApi = params => {
	//${config.pre}
	const url = `${config.pre}/supplier-activity/supplier/page?pageNum=${params.pageNum}&pageSize=${params.pageSize}`
	return api.post(url, params)
}

export const supplierTypeListApi = () => {
	const url = `${config.pre}/supplier-activity/supplierType/list`;
	return api.get(url)
}

export const goodsSourceListApi = () => {
	const url = `${config.pre}/supplier-activity/goodsSource/list`;
	return api.get(url)
}

export const updateSupplierInfoApi = (params) => {
	const url = `${config.pre}/supplier-activity/supplier/update`;
	return api.put(url, params)
}

export const updateSupplierParentIdApi = (params, parentId) => {
	const url = `${config.pre}/supplier-activity/supplier/updateParentId/${parentId}`;
	return api.put(url, params)
}

export const getChildSupplierApi = (params) => {
	const url = `${config.pre}/supplier-activity/supplier/child/list?pageNum=${params.pageNum}&pageSize=${params.pageSize}`;
	return api.post(url, params)
}

export const amountList = params => {
	const url = `${config.pre}/supplier-activity/amount/list?pageNum=${params.pageNum}&pageSize=${params.pageSize}`
	return api.post(url, params)
}

export const amountInfo = supplierId => {
	const url = `${config.pre}/supplier-activity/amount/find/${supplierId}`
	return api.get(url)
}

export const amountType = () => {
	const url = `${config.pre}/supplier-activity/amount/type`
	return api.get(url)
}

export const amountEdit = params => {
	const url = `${config.pre}/supplier-activity/amount/save`
	return api.post(url, params)
}

export const allCategory = () => {
	const url = `${config.pre}/index/nav/all`
	return api.get(url)
}

export const authCategory = (supplierId, params) => {
	const url = `${config.pre}/supplier/category/auth/${supplierId}`
	return api.post(url, params)
}

export const authCategoryIds = supplierId => {
	const url = `${config.pre}/supplier/category/${supplierId}`
	return api.get(url)
}